import java.util.Stack;


public class MotorCautare {
	protected final int MAX = 100;
	protected Rute rute[] = new Rute[MAX];
	protected int nrRute = 0;
	Stack btStack = new Stack();
	
	public void adaugaRute(String p, String d, int dist, boolean rutier, 
			boolean ferovial, boolean fluvial){
		if(nrRute<MAX){
			Rute z = new Rute(p, d, dist, rutier, ferovial, fluvial);
			rute[nrRute]=z;
			nrRute++;
		}
		else System.out.println("Nu mai poate fi adaugat nici o ruta. . . ");
	 }
	public void setup(){
		adaugaRute("Timisoara","Biled", 10, true, true, false);
		adaugaRute("Biled","Lovrin", 7, true, true, false);
	}
	int match(String plecare, String destinatie){
		int dist = 0;
		for (int i = 0; i<nrRute; i++){
			if (rute[i].LocalitatePlecare.equals(plecare) &&
					rute[i].LocalitateSosire.equals(destinatie)&& rute[i].skip==false)
			{
				dist=rute[i].distanta;
				rute[i].skip=true;
			}
		}
		return dist;
	}
	Rute find(String from){
		Rute r = null;
		for(int i=0; i<nrRute; i++){
			if(rute[i].LocalitatePlecare.equals(from)&& rute[i].skip==false){
				r = new Rute(from, rute[i].LocalitatePlecare, rute[i].distanta, 
						rute[i].rutier, rute[i].ferovial, rute[i].fluvial);
				rute[i].skip=true;
			}
		}
		return r;
	}
	void calculRuta ( String from , String to ) {
		int dist;
		Rute z;
		
		}
	}
